package com.wxxymakers.grademark.service;

import com.wxxymakers.grademark.model.entity.WxRole;
import com.wxxymakers.grademark.model.mapper.WxRoleMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @AUTHOR soft
 * @DATE 2018/12/21 14:59
 * @DESCRIBE
 */
@Service
public class WxRoleService {

    @Autowired
    private WxRoleMapper roleMapper;

    @Transactional
    public boolean add(WxRole role) {
        return roleMapper.insert(role) > 0;
    }

    @Transactional
    public boolean delete(int id) {
        return roleMapper.deleteById(id) > 0;
    }

    @Transactional
    public boolean change(WxRole role) {
        return roleMapper.updateById(role) > 0;
    }

    public WxRole byId(int id) {
        return roleMapper.selectById(id);
    }

    public List<WxRole> list() {
        return roleMapper.selectList(null);
    }
}
